home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 5 / BBS in a Box -Volume V (BBS in a Box) (April 1992).iso / Files / Prog / M / MCLUTILS.CPT / oodles-of-utils / mixin-madness / simple-view-mixins / video-svm.lisp / video-svm.lisp
Encoding:
Text File  |  1991-10-23  |  5.0 KB  |  154 lines  |  [TEXT/CCL2]

  1. (in-package :oou)
  2. (provide :video-svm)
  3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4. ;; :video-svm.lisp
  5. ;;
  6. ;; Copyright © 1991 Northwestern University Institute for the Learning Sciences
  7. ;; All Rights Reserved
  8. ;;
  9. ;; author: Michael S. Engber
  10. ;;
  11. ;; mixin for adding video to views
  12. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  13.  
  14. (oou-dependencies
  15.  :video-player
  16.  :video-digitizer-svm
  17.  )
  18.  
  19. (export '(video-svm
  20.            ))
  21.  
  22. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  23. #|
  24.  
  25. This mixin facilitates display video in views. It's a specialization of
  26. video-digitizer-svm, which incorporates control over the video player,
  27. along with control of the on screen digitizing.
  28.  
  29. It uses a slot to hold a player object and provides methods which issue
  30. the basic video commands to this player object. More control can be
  31. achieved by manipilating the player object directly.
  32.  
  33.  
  34. See Also
  35.  video-digitizer-svm - inherited behavior
  36.  video-player        - for more info on video player objects
  37.  ??-vp               - board-specific -vp files for individual player classes.
  38.  
  39. Initargs
  40.  
  41.  :player-class [none]
  42.    The class of video player object to use.
  43.    (e.g. 'P330-vp for a Pioneer 330 laserdisk juke-box/boat-anchor)
  44.  
  45.  :player-object [none]
  46.    This initarg can be used to provide an already existing player object.
  47.    Allows multiple views to share a common player object. For shared player
  48.    objects you may want to use a nil :dispose-vd-on-remove-p. See below.
  49.  
  50.  :dispose-vp-on-remove-p [t]
  51.    This flag determines if vp-dispose is called on the player object
  52.    when the view is removed from it's window.
  53.  
  54.   All the video-digitizer-svm initargs are accepted
  55.   
  56.   All the video-player initargs are also accepted and used in
  57.   creating the player object. (the entire initarg list is passed along)
  58.  
  59.   All the video-digitizer initargs are also accepted and used in
  60.   creating the digitizer object. (the entire initarg list is passed along)
  61.  
  62.  
  63. Methods of Interest
  64.  
  65.  vp-load
  66.  vp-loaded-p
  67.  vp-features
  68.  vp-seek
  69.  vp-play
  70.  vp-play-clip
  71.  vp-scan
  72.  vp-jump
  73.  vp-step
  74.  vp-stop
  75.  vp-freeze
  76. See video-player for descriptions of these methods. The video-svm versions.
  77. behave the same + appropriate calls to the digitizer. (e.g. vp-play also
  78. starts digitizing, vp-stop also stops digitizing, ...)
  79.  
  80. |#
  81. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  82.  
  83. (defclass video-svm (video-digitizer-svm)
  84.   ((player-class           :initarg :player-class)
  85.    (player-object          :initarg :player-object
  86.                            :accessor player-object)
  87.    (dispose-vp-on-remove-p :initarg :dispose-vp-on-remove-p)
  88.    )
  89.   (:default-initargs
  90.     :dispose-vp-on-remove-p t))
  91.  
  92. (defmethod initialize-instance :after ((sv video-svm) &rest initargs
  93.                                        &key 
  94.                                        &allow-other-keys)
  95.   (declare (dynamic-extent initargs))
  96.   (unless (slot-boundp sv 'player-object)
  97.     (setf (player-object sv)
  98.           (apply 'make-instance (slot-value sv 'player-class)
  99.                  :allow-other-keys t
  100.                  initargs))))
  101.  
  102. (defmethod install-view-in-window :after ((sv video-svm) window)
  103.   (declare (ignore window))
  104.   (vp-init (player-object sv)))
  105.  
  106. (defmethod remove-view-from-window :before ((sv video-svm))
  107.   (with-slots ((vp player-object)) sv
  108.     (vp-stop vp)
  109.     (when (slot-value sv 'dispose-vp-on-remove-p) (vp-dispose vp))))
  110.  
  111. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  112.  
  113. (defmethod vp-load ((sv video-svm) &rest rest &key &allow-other-keys)
  114.   (apply 'vp-load (player-object sv) rest))
  115.   
  116. (defmethod vp-loaded-p ((sv video-svm))
  117.   (funcall 'vp-loaded-p (player-object sv)))
  118.   
  119. (defmethod vp-features ((sv video-svm))
  120.   (funcall 'vp-features (player-object sv)))
  121.   
  122. (defmethod vp-seek ((sv video-svm) frame &rest rest &key &allow-other-keys)
  123.  (apply 'vp-seek (player-object sv) frame rest))
  124.  
  125. (defmethod vp-play ((sv video-svm))
  126.   (funcall 'vp-play (player-object sv))
  127.   (unless (digitizing-p sv) (start-digitizing sv)))
  128.  
  129. (defmethod vp-play-clip ((sv video-svm) start-frame end-frame &rest rest &key &allow-other-keys)
  130.   (apply 'vp-seek (player-object sv) start-frame end-frame rest))
  131.  
  132. (defmethod vp-scan ((sv video-svm) direction speed-x)
  133.   (funcall 'vp-scan (player-object sv) direction speed-x)
  134.   (unless (digitizing-p sv) (start-digitizing sv)))
  135.  
  136. (defmethod vp-jump ((sv video-svm) direction frame-count)
  137.   (funcall 'vp-jump (player-object sv) direction frame-count)
  138.   (unless (digitizing-p sv) (grab-one-frame sv)))
  139.  
  140. (defmethod vp-step ((sv video-svm) direction)
  141.   (funcall 'vp-step (player-object sv) direction)
  142.   (unless (digitizing-p sv) (grab-one-frame sv)))
  143.  
  144. (defmethod vp-stop ((sv video-svm))
  145.   (when (digitizing-p sv) (stop-digitizing sv))
  146.   (funcall 'vp-stop (player-object sv)))
  147.  
  148. (defmethod vp-freeze ((sv video-svm))
  149.   (when (digitizing-p sv) (stop-digitizing sv))
  150.   (funcall 'vp-freeze (player-object sv)))
  151. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  152. #|
  153. an example can be found in video-example.lisp
  154. |#